/**
 * Created by xiedongfeng on 2017/7/27.
 */

$(function () {
    var $iosActionsheet = $('.dc-nutrition');
    var $iosMask = $('.dc-mask');

    function hideActionSheet() {
        $iosActionsheet.removeClass('dc-nutrition-toggle');
        $iosMask.fadeOut(200);
        $iosMask.css('opacity', '1')
    }

    $iosMask.on('click', hideActionSheet);
    $('.dc-btn').on('click', hideActionSheet);
    $(".dc-btn").on("click", function () {
        $iosActionsheet.addClass('dc-nutrition-toggle');
        $iosMask.fadeIn(200);
    });

    $('.dc-nav a').click(function () {
        $(this).addClass("dc-active").siblings().removeClass("dc-active");
        var id = $(this).data("id");
        //$(".dc-foods>div").eq(id-1).stop().animate({"opacity":"1"}).siblings().stop().animate({"opacity":"0"});
        $(".dc-foods>div").eq(id - 1).stop().animate({"display": "block"}).siblings().stop().animate({"display": "none"});
        $(".meun-list").removeClass('dc-active');
        $(".meun-list").eq(id).addClass('dc-active')
        $(".meun-list").eq(id).find('.dc-menu-item').each(function () {
            $(this).click(function () {
                $(".meun-list").eq(id).find('.dc-menu-item').removeClass('dc-active')
                $(this).addClass('dc-active')
            })
        })

    });




});
